package pool;

import java.util.concurrent.*;

/**
 * @AUTHOR LYF
 * @DATE 2022/3/18
 * @VERSION 1.0
 * @DESC
 */
public class FutureDemo {
    public static void main(String[] args) {
        Future future = new FutureTask(() -> {
            System.out.println("执行");
            return 1;
        });

        Executor executor =  new ThreadPoolExecutor(3, 9, 10, TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(), Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy());

//        executor.execute(future);

        for (int i = 0; i < 10; i++) {
            executor.execute(()->{
                System.out.println(Thread.currentThread().getName()+"hello");
            });
        }





    }
}
